<template>
	<view>
		<u-cell-group>
			<u-cell title="订单编号:" :value="detail.orderNo"></u-cell>
			<u-cell title="委托方:" :value="detail.client"></u-cell>
			<u-cell title="型号:" :value="detail.model"></u-cell>
			<u-cell title="供应商:">
				<u-input slot="right-icon" v-model="detail.supplier" inputAlign="right" color="#696a6b">
				</u-input>
			</u-cell>
			<u-cell title="检测项目:" v-model="detail.commodityId"></u-cell>
			<u-cell title="品牌:">
				<u-input slot="right-icon" v-model="detail.brandName" inputAlign="right" color="#696a6b">
				</u-input>
			</u-cell>
			<u-cell title="批次:">
				<u-input slot="right-icon" v-model="detail.batch" inputAlign="right" color="#696a6b">
				</u-input>
			</u-cell>
			<u-cell title="产地:">
				<u-input slot="right-icon" v-model="detail.production" inputAlign="right" color="#696a6b">
				</u-input>
			</u-cell>
			<u-cell title="采购单号:" :value="detail.purchaseOrderNo"></u-cell>
			<u-cell title="订单数量:" :value="detail.sCount"></u-cell>
			<u-cell title="检测数量:" :value="detail.count"></u-cell>
			<u-cell title="是否加急:" :value="detail.urgant?'是':'否'"></u-cell>
			<u-cell title="备注:" :value="detail.remark"></u-cell>
			<u-cell title="优惠金额:" :value="'￥' + detail.disCountTotal"></u-cell>
			<u-cell title="订单金额:" :value="'￥' + detail.total"></u-cell>
			<u-cell title="支付方式:" :value="detail.payTypeValue"></u-cell>
		</u-cell-group>
		
		<u-row customStyle="margin: 10rpx 0;padding: 0 20rpx;">
			<u-col span="12">
				<view>
					<!-- <u-button text="修改" @click="editClick(detail)"></u-button> -->
				</view>
			</u-col>
		</u-row>
		
		<view class="img">
			<uni-file-picker readonly v-model="imageList" :imageStyles="imageStyles" fileMediatype="image"
				file-extname="png,jpg" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail:{},
				imageList: [],
				imageStyles: {
					width: 110,
					height: 110,
				},
			};
		},
		methods:{
			// 编辑订单信息
			editClick(i) {
				const _that = this
				uni.showModal({
					title: '确定要修改订单信息吗?',
					success: function (res) {
						if (res.confirm) {
							let obj = {
								orderNo: _that.detail.orderNo,
								brandName: _that.detail.brandName,
								batch: _that.detail.batch,
								supplier: _that.detail.supplier,
								production: _that.detail.production
							}
							uni.request({
								url: 'https://wechat.atptest.com:44387/api/PCApplet/UpdateOrders_Admin',
								method: 'POST',
								data: obj,
								success(res) {
									uni.showToast({
										title:'修改成功！',
										icon: 'success'
									})
								}
							})
						}
					}
				});
			},
		},
		onLoad(option) {
			this.detail = JSON.parse(option.i)
			this.imageList = this.detail.img.map((item) => {
				return {
					"name": item,
					"extname": item,
					"url": item,
				}
			})
		},
	}
</script>

<style lang="scss" scoped>
	/deep/ .uni-file-picker__container{
		display: flex;
		flex-wrap: wrap;
		justify-content: left;
	}
	/deep/ .u-cell__body {
		padding: 4rpx 20rpx !important;
	}
	
	/deep/ .u-button--info {
		background-color: #3953b8 !important;
		color: #fff !important;
	}
	/deep/ .u-cell__value {
		width: 500rpx;
	}
</style>
